home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5213 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: ix.netcom.com!netnews
  2. From: jdmorris@ix.netcom.com (Jason D. Morris)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Braces and Inline Assembly?
  5. Date: Sat, 03 Feb 1996 01:28:44 GMT
  6. Organization: Netcom
  7. Message-ID: <4eudng$59c@ixnews7.ix.netcom.com>
  8. References: <4eubgp$6ui@ixnews6.ix.netcom.com>
  9. NNTP-Posting-Host: ix-pon-mi1-17.ix.netcom.com
  10. X-NETCOM-Date: Fri Feb 02  5:28:16 PM PST 1996
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. mchamp@ix.netcom.com (Michael Champagne) wrote:
  14.  
  15. >Ok..  I'm new to using inline assembly and I was wondering why this
  16. >compiles:
  17.  
  18. >void set_mode(const int mode)
  19. >{
  20. >  asm  {
  21. >    mov AH, 0;
  22. >    mov AL, byte ptr mode;
  23. >    int 10h;
  24. >  }
  25. >}
  26.  
  27. >and this doesn't..
  28.  
  29. >void set_mode(const int mode)
  30. >{
  31. >  asm
  32. >  {
  33. >    mov AH, 0;
  34. >    mov AL, byte ptr mode;
  35. >    int 10h;
  36. >  }
  37. >}
  38.  
  39. >Seems like it's the exact same code..   does the placement of the
  40. >braces matter when using the 'asm' statement?  In the second one the
  41. >compiler doesn't recognize the 'mov' and says there needs to be a
  42. >couple of semicolons stuck in there. 
  43.  
  44. >Thanks in advance,
  45.  
  46. >Mike
  47.  
  48.  
  49. Sounds like you're using an older version of Borland C/C++.  Perhaps
  50. version 3.1 or prior?  In those versions the opening brace is required
  51. on the same line as the the asm keyword.  In later versions, the brace
  52. doesn't have to be anywhere special.
  53.  
  54. Jason
  55.  
  56.  
  57.